<template>
	<view class="content">
		<!-- 		<view class="header"><image src="../../static/shilu-login/logo.png"></image></view> -->
		<view class="list">
			<agent-reg v-if="pageType == 'agent'"></agent-reg>
			<agent-staff-reg v-if="pageType == 'as'" :agentopenid="agentOpenId" :noReg="noReg"></agent-staff-reg>
		</view>
	</view>
</template>

<script>
import { mapActions } from 'vuex';
import agentReg from './agentReg.vue';
import agentStaffReg from './agentStaffReg.vue';
export default {
	components: {
		agentReg,
		agentStaffReg
	},
	onLoad(obj) {
		console.log(obj);
		this.pageType = obj.t;
		if (obj.phone) {
			this.phoneno = obj.phone;
		}
		if (obj.t == 'as' && obj.id) {
			this.agentOpenId = obj.id;
		}
		if (obj.noReg) {
			this.noReg = true;
		}
		//#ifdef MP-WEIXIN
		if (obj.scene) {
			let scene = decodeURIComponent(obj.scene);
			try {
				let arr = scene.split('&');
				let cacheObj = {};
				arr.forEach((e, i) => {
					let str = e.split('=');
					cacheObj[str[0]] = str[1];
				});
				if (cacheObj.t && cacheObj.t == 'as' && cacheObj.id) { // 员工
					this.pageType = 'as';
					this.agentOpenId = cacheObj.id;
				}
			} catch (e) {
				//TODO handle the exception
				uni.showModal({
					title: '出错了',
					content: '获取页面参数失败',
					showCancel: false
				});
			}
		}
		//#endif
	},
	onUnload() {},
	onReady() {},
	data() {
		return {
			pageType: '',
			agentOpenId: '',
			noReg: false
		};
	},
	computed: {},
	methods: {}
};
</script>

<style lang="less">
.content {
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.header {
	width: 161upx;
	height: 161upx;
	background: rgba(63, 205, 235, 1);
	box-shadow: 0upx 12upx 13upx 0upx rgba(63, 205, 235, 0.47);
	border-radius: 50%;
	margin-top: 30upx;
	margin-left: auto;
	margin-right: auto;
}
.header image {
	width: 161upx;
	height: 161upx;
	border-radius: 50%;
}

.list {
	display: flex;
	flex-direction: column;
	padding-top: 50upx;
	padding-left: 70upx;
	padding-right: 70upx;
}
.list-call {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	height: 100upx;
	color: #333333;
	border-bottom: 1upx solid rgba(230, 230, 230, 1);
}
.list-call .img {
	width: 40upx;
	height: 40upx;
}
.list-call .biaoti {
	flex: 1;
	text-align: left;
	font-size: 32upx;
	line-height: 100upx;
	margin-left: 16upx;
}
.yzm {
	color: #ff7d13;
	font-size: 24upx;
	line-height: 64upx;
	padding-left: 10upx;
	padding-right: 10upx;
	width: auto;
	height: 64upx;
	border: 1upx solid #ffa800;
	border-radius: 50upx;
}
.yzms {
	color: #999999 !important;
	border: 1upx solid #999999;
}
.dlbutton {
	color: #ffffff;
	font-size: 34upx;
	width: 470upx;
	height: 100upx;
	background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
	box-shadow: 0upx 0upx 13upx 0upx rgba(164, 217, 228, 0.2);
	border-radius: 50upx;
	line-height: 100upx;
	text-align: center;
	margin-left: auto;
	margin-right: auto;
	margin-top: 100upx;
}
.dlbutton-hover {
	background: linear-gradient(-90deg, rgba(63, 205, 235, 0.9), rgba(188, 226, 158, 0.9));
}
.xieyi {
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	font-size: 30upx;
	margin-top: 80upx;
	color: #ffa800;
	text-align: center;
	height: 40upx;
	line-height: 40upx;
}
.xieyi image {
	width: 40upx;
	height: 40upx;
}

.btnContainer {
	margin-top: 64rpx;
	text-align: center;
	button {
		height: 82rpx;
		width: 400rpx;
		color: white;
	}
}
</style>
